package com.astudio.lhasa.model;

import android.os.Parcel;
import android.os.Parcelable;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;

@Entity
public class City implements Parcelable{

    @Id(autoincrement = true)
    private Long id;

    private String name;
    private String summary;
    private String images;

    private double locationLat;


    protected City(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readLong();
        }
        name = in.readString();
        summary = in.readString();
        images = in.readString();
        locationLat = in.readDouble();
        locationLon = in.readDouble();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (id == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(id);
        }
        dest.writeString(name);
        dest.writeString(summary);
        dest.writeString(images);
        dest.writeDouble(locationLat);
        dest.writeDouble(locationLon);
    }

    public static final Creator<City> CREATOR = new Creator<City>() {
        @Override
        public City createFromParcel(Parcel in) {
            return new City(in);
        }

        @Override
        public City[] newArray(int size) {
            return new City[size];
        }
    };

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getImages() {
        return images;
    }

    public void setImages(String images) {
        this.images = images;
    }

    public double getLocationLat() {
        return locationLat;
    }

    public void setLocationLat(double locationLat) {
        this.locationLat = locationLat;
    }

    public double getLocationLon() {
        return locationLon;
    }

    public void setLocationLon(double locationLon) {
        this.locationLon = locationLon;
    }

    private double locationLon;

    @Generated(hash = 848334367)
    public City(Long id, String name, String summary, String images,
            double locationLat, double locationLon) {
        this.id = id;
        this.name = name;
        this.summary = summary;
        this.images = images;
        this.locationLat = locationLat;
        this.locationLon = locationLon;
    }

    @Generated(hash = 750791287)
    public City() {
    }


    @Override
    public int describeContents() {
        return 0;
    }
}
